   {if $cananswerthisquestion==true}
    <div class="answerbox" style="margin-top: 40px;display:none;">

     {if $iswxbrower==null&&$setting['code_ask']&&$user['credit1']<$setting['jingyan']}
    <div  id="codetip" class=" " style="color:#777;font-size:12px;position:relative;bottom:35px;left:10px;">验证码不能为空</div>
      {/if}
      <div class="commentboard" style="background:#fff;position:relative;bottom:0px;left:0px;height:auto;width:100%;">

        <form id="huidaform"  name="answerForm"  method="post" >
       <input type="hidden" value="{$qid}" id="ans_qid" name="qid">
                <input type="hidden" value="{$question['title']}" id="ans_title" name="title">

     <div  style="border-radius:5px;width:100%;hegiht:300px;position:relative;bottom:50px;left:0px;border:none;padding-top:10px;">
      <!--{template editor}-->
     </div>

    <div class="" style="position:relative;top:-22px;margin-right:12px;">

          
               {if $iswxbrower==null&&$setting['code_ask']&&$user['credit1']<$setting['jingyan']}
             <div class="" style="position:relative;top:-10px;text-align:right;margin-top:20px;">

     <input type="text"  id="code" name="code" onblur="check_code();" placeholder="输入验证码"  style="font-size:15px;border:none;width:100px;hegiht:30px;position:relative;border: solid 1px #ccc;    outline: none;">
     <img class="hand" src="{url user/code}" onclick="javascript:updatecode();" id="verifycode" style="width:50px;position:relative;top:5px;">

    </div>
       {/if}
    <div class="" style="margin-top:20px;text-align: right;padding:0px;">
   
       <input type="hidden" id="tokenkey" name="tokenkey" value='{$_SESSION["answertoken"]}'/>
     <button  type="button" id="answsubmit" class="ui-btn ui-btn-primary" style="position:relative;bottom:10px;">
        确定
    </button>
    </div>
</div>
    </form>
     </div>
    </div>
    <script type="text/javascript">
    var submit=false;
    $("#answsubmit").click(function(){
    	 var _chakanjine=$.trim($("#chakanjine").val());
    	 if(_chakanjine==''){
    		 _chakanjine=0;
    	 }
    	  if(!isNaN(_chakanjine)){

    	    }else{
    	    	 _chakanjine=0;
    	    }
    	// var eidtor_content= $.trim($("#anscontent").val());
    	 // 获取编辑器区域
            var _txt = editor.wang_txt;
         // 获取 html
            var eidtor_content =  _txt.html();
    		if(eidtor_content==''){
    			 el2=$.tips({
    		         content:'回答不能为空',
    		         stayTime:2000,
    		         type:"info"
    		     });
    			 return false;
    		}
    	  <!--{if $setting['code_ask']}-->
    	  var data={
    			  tokenkey:$("#tokenkey").val(),
    			  chakanjine:_chakanjine,
     			content:eidtor_content,
     			qid:$("#ans_qid").val(),
     			title:$("#ans_title").val(),
     			code:$("#code").val()
     	}
    	    <!--{else}-->
    		var data={
    				 tokenkey:$("#tokenkey").val(),
    				chakanjine:_chakanjine,
       			content:eidtor_content,
       			qid:$("#ans_qid").val(),
         			title:$("#ans_title").val()

       	}
    	     <!--{/if}-->
    		if(submit==true){
    				
    				return false;
    			}

    			submit=true;
    	    	 var el='';
    	$.ajax({
           //提交数据的类型 POST GET
           type:"POST",
           //提交的网址

           url:"{url question/ajaxanswer}",
           //提交的数据
           data:data,
           //返回数据的格式
           datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
           //在请求之前调用的函数
           beforeSend:function(){
        	    el=$.loading({
        	        content:'加载中...',
        	    })
           },
           //成功返回之后调用的函数
           success:function(data){
        	    el.loading("hide");
           	var data=eval("("+data+")");
              if(data.message=='ok'||data.message.indexOf('成功')>=0){
            	  $("#answsubmit").attr("disabled",true);
            	  submit=true;
           	 el2=$.tips({
    	            content:data.message,
    	            stayTime:1000,
    	            type:"info"
    	        });
           	   setTimeout(function(){
                      window.location.reload();
                  },1500);
              }else{
            	  submit=false;
           	el2=$.tips({
                content:data.message,
                stayTime:1000,
                type:"info"
            });
              }


           }   ,
           //调用执行后调用的函数
           complete: function(XMLHttpRequest, textStatus){
        	    el.loading("hide");
           },
           //调用出错执行的函数
           error: function(){
               //请求出错处理
           }
        });
    	return false;
    })
</script>
    {/if}